package photorganizer.common.helper;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import photorganizer.common.exception.TechnicalException;


public class PropertiesHelper {

	public static Properties load(String name) {
		InputStream inputStream = ClassLoader.getSystemResourceAsStream(name);

		if (inputStream == null) {
			return null;
		}

		try {
			Properties result = new Properties();
			result.load(inputStream);
			return result;
		}
		catch (IOException e) {
			throw new TechnicalException(e);
		}
		finally {
			try {
				inputStream.close();
			}
			catch (IOException ignored) {
			}
		}
	}

	private PropertiesHelper() {
		assert false;
	}

}
